package com.iwanghang.movelineview;

import android.graphics.Point;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.iwanghang.movelineview.whUtil.AnimatorUtil;

/**
 * 目的是实现一个直线绘制的动画
 *      这个Demo，是在一个RelativeLayout控件中，根据起点xy，终点xy，来实现这个动画
 *      但是不限于RelativeLayout，父控件是主视图也可以，什么都行
 */
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        /**
         * 折线绘制动画
         * 折线至少有3个点
         */
        Point[] foldPoints = new Point[3];
        Point foldPoint0 = new Point(78, 467);
        foldPoints[0] = foldPoint0;
        Point foldPoint1 = new Point(352, 733);
        foldPoints[1] = foldPoint1;
        Point foldPoint2 = new Point(770, 441);
        foldPoints[2] = foldPoint2;
        AnimatorUtil.doFoldLineAnimatorPlay(this, foldPoints, 20);


        /**
         * 折线绘制动画
         * 折线至少有3个点，如果是2个点，则绘制直线
         */
//        Point[] foldPoints = new Point[2];
//        Point foldPoint0 = new Point(78, 467);
//        foldPoints[0] = foldPoint0;
//        Point foldPoint1 = new Point(352, 733);
//        foldPoints[1] = foldPoint1;
//        AnimatorUtil.doFoldLineAnimatorPlay(this, foldPoints, 20);

        /**
         * 折线绘制动画
         * 试试6个点
         */
//        Point[] foldPoints = new Point[6];
//        Point foldPoint0 = new Point(78, 467);
//        foldPoints[0] = foldPoint0;
//        Point foldPoint1 = new Point(352, 733);
//        foldPoints[1] = foldPoint1;
//        Point foldPoint2 = new Point(770, 441);
//        foldPoints[2] = foldPoint2;
//        Point foldPoint3 = new Point(383, 957);
//        foldPoints[3] = foldPoint3;
//        Point foldPoint4 = new Point(475, 1250);
//        foldPoints[4] = foldPoint4;
//        Point foldPoint5 = new Point(316, 1445);
//        foldPoints[5] = foldPoint5;
//        AnimatorUtil.doFoldLineAnimatorPlay(this, foldPoints, 20);

    }

}
